package com.huanbao.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huanbao.base.lang.Result;
import com.huanbao.entity.UserReport;
import com.huanbao.service.UserReportService;
import com.huanbao.util.ShiroUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户举报表 前端控制器
 * </p>
 *
 * @author zq
 * @since 2021-04-01
 */
@RestController
@RequestMapping("/user-report")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserReportController {

    private final UserReportService userReportService;

    @GetMapping("/getOne")
    public Result getOneReport() {
        Long userId = ShiroUtil.getProfile().getId();
        UserReport one = userReportService.getOne(new QueryWrapper<UserReport>().eq("user_id", userId));
        return Result.success(one);
    }

}
